/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.config.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.hera.base.domain.BaseDomain;
import com.hera.process.security.domain.User;
import com.hera.process.workflow.domain.Swimlane;

/**
 *
 * @author cmontes
 */
@Entity
public class Department extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "Department")
    @TableGenerator(name = "Department", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "LoginMethod", allocationSize = 1)
    @Column(name = "ID_DEPARTMENT")
    private Long idDepartment;
    private String name;
    private String description;
    @Column(name = "INT_DEPARTMENT_CODE")
    private String intDepartmentCode;

    //@OneToMany(cascade = CascadeType.ALL, mappedBy = "department")
    @Transient
    private List<Swimlane> swimlaneList;
    //@OneToMany(mappedBy = "department")
    @Transient
    private List<User> sysUserList;
    @JoinColumn(name = "ID_ORGANIZATION", referencedColumnName = "ID_ORGANIZATION")
    @ManyToOne
    private Organization organization;
   // @OneToMany(mappedBy = "department")
    @Transient
    private List<Department> departmentList;
    @JoinColumn(name = "ID_PARENT", referencedColumnName = "ID_DEPARTMENT")
    @ManyToOne
    private Department department;

    public Department() {
    }

    public Department(Long idDepartment) {
        this.idDepartment = idDepartment;
    }

    public Long getIdDepartment() {
        return idDepartment;
    }

    public void setIdDepartment(Long idDepartment) {
        this.idDepartment = idDepartment;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getIntDepartmentCode() {
        return intDepartmentCode;
    }

    public void setIntDepartmentCode(String intDepartmentCode) {
        this.intDepartmentCode = intDepartmentCode;
    }

    public List<Swimlane> getSwimlaneList() {
        return swimlaneList;
    }

    public void setSwimlaneList(List<Swimlane> swimlaneList) {
        this.swimlaneList = swimlaneList;
    }

    public List<User> getSysUserList() {
        return sysUserList;
    }

    public void setSysUserList(List<User> sysUserList) {
        this.sysUserList = sysUserList;
    }

    public Organization getOrganization() {
        return organization;
    }

    public void setOrganization(Organization organization) {
        this.organization = organization;
    }

    public List<Department> getDepartmentList() {
        return departmentList;
    }

    public void setDepartmentList(List<Department> departmentList) {
        this.departmentList = departmentList;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDepartment != null ? idDepartment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof Department)) {
            return false;
        }
        Department other = (Department) object;
        if ((this.idDepartment == null && other.idDepartment != null) || (this.idDepartment != null && !this.idDepartment.equals(other.idDepartment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.Department[ idDepartment=" + idDepartment + " ]";
    }
    
}
